import React, { useEffect, useState } from 'react';
import { Space, Table, Tag } from 'antd';
import type { TableProps } from 'antd';
import request from '../../api/request'

function Index() {
  interface DataType {
  key: string;
  name: string;
  age: number;
  address: string;
  tags: string[];
}
let [arr,setarr]=useState([])

let getdata=()=>{
  request.get('/article/list',{
    page:1,//页码  必传
pageSize:6,//每页显示条数 必传

  }).then(res=>{

    console.log('列表',res)
    setarr(res.data.rows)
  })
}
useEffect(()=>{
  getdata()
},[])
const columns: TableProps<DataType>['columns'] = [
  {
    title: 'Name',
    dataIndex: 'createdAt',
    key: 'createdAt',
    render: (text) => <a>{text}</a>,
  },
  {
    title: 'Age',
    dataIndex: 'content',
    key: 'content',
  },
  {
    title: 'Address',
    dataIndex: 'title',
    key: 'title',
  },
  {
    title: 'Action',
    key: 'action',
    render: (_, record) => (
      <Space size="middle">
        <a>Invite {record.name}</a>
        <a>Delete</a>
      </Space>
    ),
  },
];



  return (
    <div>
      <Table<DataType> columns={columns} dataSource={arr} />
    </div>
  )
}

export default Index
